//
//  Person.m
//  isa
//
//  Created by 崔博 on 2018/7/1.
//  Copyright © 2018年 崔博. All rights reserved.
//
//#define TallMask 1
//#define RichMask 2
//#define HandsomeMask 4

//#define TallMask 0b0000001
//#define RichMask 0b0000010
//#define HandsomeMask 0b0000100

#define TallMask (1<<0)
#define RichMask (1<<1)
#define HandsomeMask (1<<2)

#import "Person.h"
@interface Person()
{
    // 位域
    union {
        char bits;
        struct {
            char tall : 1;
            char rich : 1;
            char handsome : 1;
        }
    }_tallRichHasome;
    
    
}
@end
@implementation Person
- (instancetype)init
{
    self = [super init];
    if (self) {
        
    }
    return self;
}
- (void)setHansome:(BOOL)hansome
{
    if (hansome) {
        _tallRichHasome.bits |= HandsomeMask;
    }else
    {
        _tallRichHasome.bits &= ~HandsomeMask;
    };
    
}
- (BOOL)hansome
{
    return !!(_tallRichHasome.bits & HandsomeMask);
}
-
@end
